package com.study.hot.jetpack.demo_shopping.fragment

import com.study.base.BaseFragment
import com.study.hot.R
import com.study.hot.jetpack.demo_shopping.viewmodel.ProductModel
import com.study.hot.jetpack.demo_shopping.viewmodel.factory.ProductModelFactory

/**
 * <pre>
 *     author : fauks
 *     time   : 2020/03/27
 *     desc   :
 * </pre>
 */
class MainFragment : BaseFragment() {
    override fun getLayoutId() = R.layout.main_fragment

    override fun initView() {
        super.initView()
        //获取商品ViewModel，如果无参
        //val productModel = ViewModelProvider(this)[ProductModel::class.java]

        //获取有参数的ViewModel,需要使用自定义的Factory
        val productModel = ProductModelFactory(1).create(ProductModel::class.java)

    }
}